using System;
using System.Drawing;
using System.Windows.Forms;


// Image Label, can be used as a fake of transparent labels (unsupported on .NET CE)
public class ImageLabel:Control
{
	private Bitmap	bufferBitmap;
	private Image	img_background;
	private Font	f_text;
	private Color	c_text;
	private SolidBrush b_text;


	public ImageLabel (Rectangle dimensions, Image background, Font f, Color c):base()
	{
		this.Bounds= dimensions;
		img_background = background;
		f_text = f;
		c_text = c;
		b_text = new SolidBrush(c_text);
		bufferBitmap = new Bitmap (this.Bounds.Width, this.Bounds.Height);
	}

	protected override void OnPaintBackground(PaintEventArgs e)
	{
		Graphics gxOff; //Offscreen graphics

		gxOff = Graphics.FromImage(bufferBitmap);
		gxOff.DrawImage(this.img_background, 0,0);

		gxOff.DrawString(this.Text, f_text, b_text, 0,0);
		
		e.Graphics.DrawImage(bufferBitmap, 0, 0);//copy back to screen
	}
}

 